package com.xhs.main.service.cwb.impl;

import com.xhs.main.dao.cwb.CwbProposerDao;
import com.xhs.main.entity.cwb.CwbProposer;
import com.xhs.main.service.cwb.CwbProposerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CwbProposerServiceImpl implements CwbProposerService {

    @Autowired
    CwbProposerDao cwbProposerDao;


    @Override
    public void addCwbProposer(CwbProposer cwbProposer) {
        cwbProposerDao.insertCwbProposer(cwbProposer);
    }

    @Override
    public List<CwbProposer> getAllCwbProposer() {
        List<CwbProposer> cwbProposerList = cwbProposerDao.selectAllCwbProposer();
        return cwbProposerList;
    }

    @Override
    public CwbProposer getOneByID(Integer cwbPId) {
        CwbProposer cwbProposer = cwbProposerDao.selectOneByID(cwbPId);
        return cwbProposer;
    }

    @Override
    public List<CwbProposer> getAllCwbProposerByLimit(Integer page, Integer limit) {
        List<CwbProposer> cwbProposerList = cwbProposerDao.selectAllCwbProposerByLimit(page,limit);
        return cwbProposerList;
    }

    //条件模糊查询
    @Override
    public List<CwbProposer> getAllProposerByCondition(String employeeID, String applyType, String people, String department,Integer page,Integer limit) {
        List<CwbProposer> cwbProposers = cwbProposerDao.selectByCondition(employeeID, applyType, people,
                department,page,limit);
        return cwbProposers;
    }

    //软删除信息
    @Override
    public Integer updateOneID(Integer id) {
        Integer result = cwbProposerDao.setOneID(id);
        return result;
    }

    //更新申请信息
    @Override
    public void updateOneApply(String reason, String bill, Integer id) {
        cwbProposerDao.updateApply(reason, bill, id);
    }

    @Override
    public Double getAllMoney() {
        Double money = cwbProposerDao.selectAllMoney();
        return money;
    }

    @Override
    public Integer getAllOpr() {
        Integer count = cwbProposerDao.selectAllOpr();
        return count;
    }

    @Override
    public Integer getAllNoOpr() {
        Integer count = cwbProposerDao.selectAllNoOpr();
        return count;
    }
}
